﻿using Gp.Scripts.GUI;

namespace Gp.Scripts.Core {
    public class BlockAttackGestureTrigger : UnitGestureTrigger {
        public BaseUnit Attacker;

        public BlockAttackGestureTrigger(BaseUnit attacker) {
            Attacker = attacker;
        }

        public override void OnTrigger() {
            // 转向攻击者
            if (Attacker != null) Model.ForwardToTarget(Attacker.transform.position);
            Animator.Play(UnitAnimatorStateId.BlockAttackState);
            // 生成特效
            Global.Get<GridBattleGUISystem>().PlayFloatingText(UnitReference, "格挡");
        }
    }
}